#ifndef BRUSHUTILITIES_H
#define BRUSHUTILITIES_H
#include <vector>
#include <iostream>
#include "tool.h"
#include "vector3.h"
#include "rendermanager.h"
#include "globalstates.h"
#include "voxel.h"
#include "Drawing.h"
#include <sstream>

class BrushUtilities
{
#define IS_SUCCESSFUL true
#define MSG_SUCCESS "Voxels have been added"
#define MSG_FAIL "Voxels have not been added"

private:
    //enum FIXED_AXES {NO_AXIS = 0, XAXIS = 1, YAXIS=2, ZAXIS = 4};

    vector3<int> coords;
    int size; //also stands in for length
    int breadth;
    int height;
    int shape;
    vector< pair<string, set<vector3<int> > > > customShapes;
    GlobalStates* global;
    BrushUtilities();
    float dist;
    bool mouseMove;
    char axesToFix;
public:

    enum KEY_SHORTCUTS {KEY_FIX_X = Qt::Key_X,
                        KEY_FIX_Y = Qt::Key_C,
                        KEY_FIX_Z = Qt::Key_Z,
                        KEY_FIX_PLANE = Qt::ControlModifier};
    enum SHAPES{CUBE=1, CUBOID=2, SPHERE=3, PYRAMID=4, COUNT=4}; //COUNT is the number of shapes there are.
                                                                //Please change accordingly when adding/removing default shapes.
    enum MODE{ADD=1, DISPLAY_ADD =2, ERASE = 3, DISPLAY_ERASE = 4};

    //get and set methods
    static BrushUtilities* getInstance();

    string getShapeName(int i);

    bool isAxisFixed(FIXED_AXES axis);
    Result setSize(int a);
    Result setSize(int s, int h, int b);
    Result setShape(int a);
    Result setHeight(int a);
    Result setBreadth(int a);
    Result setAxis(FIXED_AXES axis, bool toFix);
    Result setShapeName(int identifier, string n);
    Result addShape(); //adds custom shape, based on selection
    Result addShape(string n);
    Result deleteShape(int i);

    //backend
    Result execute(MODE m);

    //mouse events
    Result mouseEnterEvent(QEvent *event);
    Result mouseLeaveEvent(QEvent *event);
    Result keyPressEvent(QKeyEvent *event);
    Result keyReleaseEvent(QKeyEvent *event);
    Result mousePressEvent(QMouseEvent *event);
    Result mouseMoveEvent(QMouseEvent *event);



    //friend
    friend class BrushTool;
    friend class EraserTool;
    friend class BrushToolATD;
    friend class SelectionToolATD;
    friend class MagicBrushATD;
};

#endif // BRUSHUTILITIES_H
